/**
 * @计算整数的正整数次方
 *
 * @author	 wangshikun <wangshikun2010@gmail.com>
 * @copyright	(c) 2012 wangshikun <wangshikun2010@gmail.com>
 * @license	http://www.opensource.org/licenses/mit-license.php The MIT License
 * @package	default
 * @subpackage	default
 */

#include <stdio.h>
#include <math.h>

int getPositiveNumber(char *prompt);

int main(int argc, char *argv[]) {

int number = getPositiveNumber("请输入底数");
	int n = getPositiveNumber("请输入幂数");

	printf("%d ^ %d = %.0lf\n", number, n, pow(number, n));

	return 0;
}

int getPositiveNumber(char *prompt) {
	int number;

	do {
		printf("%s: ", prompt);
		scanf("%d", &number);
	} while (number <= 0);

	return number;
}

